﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using window;

namespace winform_news
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            string text = textBox1.Text;
            string time = textBox2.Text;
            string qqhao = textBox3.Text;
            //连接
            //         string url = $"http://wpa.qq.com/msgrd?v=3&uin={qqhao}&site=qq&menu=yes";
            //         //定义脚本
            //         string script = @"<script language='javascript' type='text/javascript'>
            //function openUrl(url){
            //window.open(url,'测试窗口','width=400px,height=400px,directories=true,location=false,menubar=false,resizeable=false,scrollbars=yes,toolbar=false ');
            //}</script>";
            //         WebBrowser wb = new WebBrowser();
            //         wb.DocumentText = @"<html> <head>" + script + "</head><body></body></html>";//定义WebBrowser中的DOM文档
            //         wb.DocumentCompleted += delegate
            //         {
            //             //执行脚本函数
            //             wb.Document.InvokeScript("openUrl", new object[] { url });
            //         };
            System.Diagnostics.Process.Start($"http://wpa.qq.com/msgrd?v=3&uin={qqhao}&site=qq&menu=yes");
            int times = 1000 / int.Parse(time);
            SJT_Window sJT_Window = new SJT_Window();
            while (true)
            {
                //MessageBox.Show(sJT_Window.ProcessName.ToLower());
             //   if (sJT_Window.ProcessName.ToLower().Equals(comboBox1.SelectedItem.ToString().ToLower()))
              //  {
                    sJT_Window.SendMessage(text);
             //   }
                Thread.Sleep(times);
            }
        }
    }
}
